<?php  
$type = $_GET["type"];
$sessionName = "";
switch($type)
{
	//coaching_booking.php
	case "1": $sessionName = "reg_num_check";
			  break;
	//aevening_enroll.php
	case "2": $sessionName = "enroll_num_check";
			  break;
	//contactus.php		  
	case "3": $sessionName = "contactus_num_check";
			  break;
	//newsletters_subscribe.php		  
	case "4": $sessionName = "subscribe_num_check";
			  break;
	default: exit();
}
session_start(); 
Header("Content-type: image/PNG");   
$im = imagecreate(55,20);  
$black = imagecolorallocate($im, 0,0,0);  
$white = imagecolorallocate($im, 255,255,255);  
$gray = imagecolorallocate($im, 200,200,200);  
imagefill($im,0,0,$gray);  
$authnum=rand(1000,9999); 
imagestring($im, 5, 10, 3, $authnum, $black);  
for($i=0;$i<200;$i++){  
    $randcolor = imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255)); 
    imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);  
}  
$_SESSION[$sessionName]=$authnum; 
imagepng($im);  
imagedestroy($im);
?> 
